Optimal. Leaf size=106 \[ -\frac{a^2 c x (c+i d)}{d^2 (c-i d)}+\frac{a^2 x (c+2 i d)}{d^2}-\frac{a^2 (-d+i c) \log (c \cos (e+f x)+d \sin (e+f x))}{d f (d+i c)}+\frac{a^2 \log (\cos (e+f x))}{d f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.123487, antiderivative size = 106, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 28, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3541, 3475, 3484, 3530} \[ -\frac{a^2 c x (c+i d)}{d^2 (c-i d)}+\frac{a^2 x (c+2 i d)}{d^2}-\frac{a^2 (-d+i c) \log (c \cos (e+f x)+d \sin (e+f x))}{d f (d+i c)}+\frac{a^2 \log (\cos (e+f x))}{d f} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3541
Rule 3475
Rule 3484
Rule 3530
Rubi steps
\begin{align*} \int \frac{(a+i a \tan (e+f x))^2}{c+d \tan (e+f x)} \, dx &=\frac{a^2 (c+2 i d) x}{d^2}-\frac{a^2 \int \tan (e+f x) \, dx}{d}+\frac{(-i a c+a d)^2 \int \frac{1}{c+d \tan (e+f x)} \, dx}{d^2}\\ &=-\frac{a^2 c (c+i d) x}{(c-i d) d^2}+\frac{a^2 (c+2 i d) x}{d^2}+\frac{a^2 \log (\cos (e+f x))}{d f}+\frac{(-i a c+a d)^2 \int \frac{d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{d \left (c^2+d^2\right )}\\ &=-\frac{a^2 c (c+i d) x}{(c-i d) d^2}+\frac{a^2 (c+2 i d) x}{d^2}+\frac{a^2 \log (\cos (e+f x))}{d f}-\frac{a^2 (i c-d) \log (c \cos (e+f x)+d \sin (e+f x))}{d (i c+d) f}\\ \end{align*}
Mathematica [A] time = 2.39091, size = 176, normalized size = 1.66 \[ \frac{a^2 \left ((-2 d-2 i c) \tan ^{-1}(\tan (3 e+f x))-c \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )-i d \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )+2 (d-i c) \tan ^{-1}\left (\frac{d \cos (3 e+f x)-c \sin (3 e+f x)}{c \cos (3 e+f x)+d \sin (3 e+f x)}\right )+c \log \left (\cos ^2(e+f x)\right )-i d \log \left (\cos ^2(e+f x)\right )+8 d f x\right )}{2 d f (c-i d)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.023, size = 204, normalized size = 1.9 \begin{align*}{\frac{i{a}^{2}\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) c}{f \left ({c}^{2}+{d}^{2} \right ) }}+{\frac{2\,i{a}^{2}\arctan \left ( \tan \left ( fx+e \right ) \right ) d}{f \left ({c}^{2}+{d}^{2} \right ) }}-{\frac{{a}^{2}\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) d}{f \left ({c}^{2}+{d}^{2} \right ) }}+2\,{\frac{{a}^{2}\arctan \left ( \tan \left ( fx+e \right ) \right ) c}{f \left ({c}^{2}+{d}^{2} \right ) }}-{\frac{2\,i{a}^{2}\ln \left ( c+d\tan \left ( fx+e \right ) \right ) c}{f \left ({c}^{2}+{d}^{2} \right ) }}-{\frac{{a}^{2}\ln \left ( c+d\tan \left ( fx+e \right ) \right ){c}^{2}}{f \left ({c}^{2}+{d}^{2} \right ) d}}+{\frac{{a}^{2}d\ln \left ( c+d\tan \left ( fx+e \right ) \right ) }{f \left ({c}^{2}+{d}^{2} \right ) }} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.7395, size = 155, normalized size = 1.46 \begin{align*} \frac{\frac{4 \,{\left (a^{2} c + i \, a^{2} d\right )}{\left (f x + e\right )}}{c^{2} + d^{2}} - \frac{2 \,{\left (a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{2} d + d^{3}} + \frac{{\left (2 i \, a^{2} c - 2 \, a^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}}}{2 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.75817, size = 197, normalized size = 1.86 \begin{align*} \frac{{\left (-i \, a^{2} c + a^{2} d\right )} \log \left (\frac{{\left (i \, c + d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d}{i \, c + d}\right ) +{\left (i \, a^{2} c + a^{2} d\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{{\left (i \, c d + d^{2}\right )} f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 4.32593, size = 181, normalized size = 1.71 \begin{align*} -\frac{-\frac{4 i \, a^{2} \log \left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + i\right )}{c - i \, d} - \frac{a^{2} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 1 \right |}\right )}{d} - \frac{a^{2} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 1 \right |}\right )}{d} + \frac{2 \,{\left (a^{2} c + i \, a^{2} d\right )} \log \left ({\left | c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - c \right |}\right )}{2 \, c d - 2 i \, d^{2}}}{f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]